/**----------------------------------------
 * @description 触摸层
 * @author      lxc
 * @file        TouchLayer.ts
 * @Date        2022-05-05
 * @version     1.0.0
 * ----------------------------------------
 */
 import { MsgComponent } from "../message/MsgComponent";
 
 const {ccclass, property} = cc._decorator;
 
 @ccclass
 export class TouchLayer extends MsgComponent {

    protected onEnable(): void {
        super.onEnable()
        this.node.on(cc.Node.EventType.TOUCH_START,this.onTouchStart.bind(this))
    }

    protected onDisable(): void {
        super.onDisable()
        this.node.on(cc.Node.EventType.TOUCH_START,this.onTouchStart.bind(this))
    }

    onTouchStart(event : cc.Event.EventTouch){
        this.printLog("onTouchStart")
        gVar.UIMsgMgr.dispatchMsg(LocalMsg.TouchInLayer, event.getLocation());
    }
 }